package java1227;

// 父类
public abstract class Car {

    public static void main(String[] args) {

//        Audi a = new Audi();
//        a.driver();
//
//        Car b = new Audi();
//        b.driver();
//
//        Car c = new Benz();
//        Benz d = (Benz)c;

//        Audi a = new Audi();
//        Benz b = new Benz();
//        m1(a);
//        m1(b);


//        Car car = new Audi(); // GC：垃圾回收机制。
//        car = null;

          int[] a = {1,2,3};
          int[] b = a;
          int[] c = b;

          b[0] = 4;
          System.out.println(a[0]);
          a[0] = 5;
        System.out.println(a[0]);
        System.out.println(b[0]);
        System.out.println(c[0]);

    }

    public static void m1(Car car) {

    }

    abstract void driver();
}

// 子类
class Audi extends Car {
    void driver() {
        System.out.println("驾驶奥迪");
    }
}

// 子类
class Benz extends Car {
    void driver() {
        System.out.println("驾驶奔驰");
    }
}